package cn.zjutleo.village_server.service;

import cn.hutool.core.date.DateTime;
import cn.zjutleo.village_server.entity.CPSigned;
import cn.zjutleo.village_server.entity.CPSignedKey;
import cn.zjutleo.village_server.mapper.CPSignedMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @Author ：杜雨茜
 * @Description ：村民互助活动报名
 * @Date ：2021/12/23 14:55
 **/
@Service
public class CPsignService {
    @Resource
    CPSignedMapper cpSignedMapper ;
    /**
     * @author: 杜雨茜
     * @description: 报名
     * @param cpSigned 报名的对象和活动
     * @return 插入的条数
     **/
    public int addsign(CPSigned cpSigned){
        return cpSignedMapper.insert(cpSigned);
    }
    /**
     * @author: 杜雨茜
     * @description: 获取报名信息
     * @param cpSignedKey 活动id，参与者id
     * @return 整条记录
     **/
    public CPSigned getExistSign(CPSignedKey cpSignedKey){
        return cpSignedMapper.selectByPrimaryKey(cpSignedKey);
    }
    /**
     * Description 删除
     **/
    public int deleteSign(CPSignedKey cpSignedKey) {
        return cpSignedMapper.deleteByPrimaryKey(cpSignedKey);
    }
    /**
     * @author: 杜雨茜
     * @description: 修改报名情况
     * @param cpSigned
     * @return 修改记录的条数
     **/
    public int updateSign(CPSigned cpSigned){
        return cpSignedMapper.updateByPrimaryKey(cpSigned);
    }

}
